Optimization with equality constraints